flowchart LR markdown --> M1[newLines]
Learning Diary
Priyal Agarwal
23102422
p.agarwal4@universityofgalway.ie
This learning diary is created to capture error occurred while learning R programming.
Diary Entry1
When I was trying to upload a CSV in R studio , I got error as Figure 1 . No such file or directory.
Solution:
It seems that CSV file is places in different path and Path setup in R is different. So checked the path of directory using getwd(). This gave the detail of current path of R, changed this path to new path using setwd(). This resolved issue and CSV got uploaded successfully.
Diary Entry2
Figure 2: No color in histogram even after giving color in code.
I was trying to create histogram to show distribution of age using above code, but when I was doing that I was getting gray color in histogram instead of light blue color which I gave.
Solution
I realized that parameter for color should be written as ‘col’ not ‘color’ after checking on google.
After changes, it worked and histogram shtarted showing correct color.
In my code I had two col one for chart and other for border, I wanted to try if I reverse the code and make ‘color’ as ‘col’ and ‘col’ to ‘color’, what will be the effect of that on my chart. Here is the modified code:
When I interchanged it, as ‘color’ doesn’t give any Color so it made the chart colorless and ‘col’ make it totally black. So in case We need to use two colors in the chart like in our case, one for chart and other for border. It’s better to use col= chart color for chart color and border= border color eliminated confusion and give correct color in chart and border.
Diary Entry3
I wanted to try mermaid to include in my quarto document so tried with the syntax I got related to mermaid and included in the document as shown in @
Even though I was already using quarto, but on the basis of comments I installed quarto packages, but it didn’t resolve this issue. I downloaded mermaid package from Git and kept in the same folder as my quarto, still issue was there. google suggested me to run code ‘chooseCRANmirror(graphics = FALSE)’ and choose one country location to utilize Cran for graphics. Tried, no solution yet :|
After that I got one link using which I was able to make graphs by utlizing DiagrammeR https://www.rdocumentation.org/packages/DiagrammeR/versions/1.0.11/topics/mermaid
library('DiagrammeR')
DiagrammeR("
graph LR
A-->B
A-->C
C-->E
B-->D
C-->D
D-->F
E-->F
")It is indeed good website and code given can be used to make graphs in R, still It didn’t fulfill my requirement. I recalled that in lecture also one sample code was given. I tried that code and it worked and I was able to make mermaid flowchart.
Diary Entry4
I tried to filter my dataset for specific countries ‘India, Ireland’ for one data analysis. But while doing this I got Figure 8 that argument filter is missing.
Solution I checked the syntax and got a link for filters related to R. https://dplyr.tidyverse.org/reference/filter.html. This link gave good explanation on filters in R. It made me realize the silly mistake I did. Instead of keeping column as Final_Join$Entity, syntax needs to be Final_Join, Entity. for filtering ‘==’ and ‘%in%’,both works. After changes code worked and ran fine.
Diary Entry5
I decided to make my GAM model Figure 10 for filtered dataset ‘Eduction_dataset_2013’, which contains data for all countries but only for year 2013.But while running I got Error Figure 11
Solution I knew that this error comes when code is returning value other than True/False(Error came for last line of code while plotting model). I further analysed my code line by line and saw that while summarising model I am getting Nan values in P values, this indicated underlying issue in the data.
Further analysis through google revealed that when we fit the model and data is not sufficient to build the model, we get this error. So I decided to run my model for my actual dataset ‘Education_dataset’. My code ran successfully.
Diary Entry6
I worked on the geomaps and was happy to implemented, but at the end moment I started getting new error Figure 12 in the code, which was working previously.
It seemed that it was not getting any directory or folder, but as I ddin’t change anything, I was unsure of this. Chatgpt suggested to Manually created the folder where files was missing as it may help R to create the Jscript, CSS files it was creating for maps. Did that but when I ran the code again after folder creation, it removed manually created folder and I started getting new error.
I changed my code, still it didn’t work. Checked github https://github.com/Leaflet/Leaflet/issues/5288 suggested to install some packages for leaflet, still no solution. After many hours of debugging and trial-error, I came to know that while formatting my document I removed Library(leaflet), which gave me a lesson to keep all libraries in first chunk to avoid unnecessary time waste. After keeping library, code ran successfully.